const state = {
  userInfo: {},
  token: ''
}

const getters = {
  getUserInfo: state => state.userInfo,
  getToken: state => state.token
}

const actions = {
  setUserInfo ({ commit }, user) {
    commit('mutationUserInfo', user)
  },
  setToken ({ commit }, token) {
    commit('mutationToken', token)
  }
}

const mutations = {
  mutationUserInfo (state, user) {
    state.userInfo = user
  },
  mutationToken (state, token) {
    state.token = token
  }
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}
